package com.lagou.myrpcconsumer.controller;

import com.lagou.myrpcconsumer.server.UserServer;
import com.lagou.rpc.api.IUserService;
import com.lagou.rpc.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserServer iUserService;

    @RequestMapping("/getById/{id}")
    public User getUserById(@PathVariable int id){
        IUserService iUserService = this.iUserService.getIUserService();
        User byId = iUserService.getById(id);
        return byId;
    }
}
